package com.aliyun.oss.task;

import com.aliyun.oss.UserService.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class OrderTask {
    @Autowired
    private OrdersService ordersService;
    /*处理超时订单*/
    @Scheduled(cron = "0 * * * * ?")
    public void processTimeoutOrder(){
//        查询订单状态为待支付状态，而且订单创建时间为当前时间-15分钟前的订单
       ordersService.processTimeoutOrder();
    }
    //    处理一直处于待派单状态的订单
    @Scheduled(cron = "0 0 1 * * ?")
    public void processDeliveryOrder(){
        ordersService.processDeliveryOrder();

    }
}
